package IC.Parser;

import java_cup.runtime.Symbol;

public class Token extends Symbol {
	
	private int line;
	private int id;
		
	 public Token(int id, int line) {
        // call super constructor for Symbol(int sym_num,int l,int r)
        super(id, ++line, 0);
        this.id = id;
        this.line = line;
    }
    
    public Token(int id, int line, Object value){
        // call super constructor for Symbol(int sym_num,int l,int r,Object value)
        super(id, ++line, 0, value);
        this.id = id;
        this.line = line;
    }
    public int getId() {
    	return id;
    }
    
    public Object getValue() {
    	return value;
    }
    
    public int getLine() {
    	return line;
    }
    
    public String toString() {
        return line + ": " + IdToString(id)  + (( value != null)? "(" + value.toString() + ")" : "");
    }
    
    public String IdToString(int id){
    	switch (id){
	    	case 0: return "ASSIGN";
	    	case 1: return "BOOLEAN";
	    	case 2: return "BREAK";
	    	case 3: return "CLASS";
	    	case 4: return "CLASS_ID";
	    	case 5: return "COMMA";
	    	case 6: return "CONTINUE";
	    	case 7: return "DIVIDE";
	    	case 8: return "DOT";
	    	case 9: return "EQUAL";
	    	case 10: return "EXTENDS";
	    	case 11: return "ELSE";
	    	case 12: return "FALSE";
	    	case 13: return "GT";
	    	case 14: return "GTE";
	    	case 15: return "ID";
	    	case 16: return "IF";
	    	case 17: return "INT";
	    	case 18: return "INTEGER";
	    	case 19: return "LAND";
	    	case 20: return "LB";
	    	case 21: return "LP";
	    	case 22: return "LCBR";
	    	case 23: return "LENGTH";
	    	case 24: return "NEW";
	    	case 25: return "LNEG";
	    	case 26: return "LOR";
	    	case 27: return "LT";
	    	case 28: return "LTE";
	    	case 29: return "MINUS";
	    	case 30: return "MOD";
	    	case 31: return "MULTIPLY";
	    	case 32: return "NEQUAL";
	    	case 33: return "NULL";
	    	case 34: return "PLUS";
	    	case 35: return "RB";
	    	case 36: return "RCBR";
	    	case 37: return "RETURN";
	    	case 38: return "RP";
	    	case 39: return "SEMI";
	    	case 40: return "STATIC";
	    	case 41: return "STRING";
	    	case 42: return "QUOTE";
	    	case 43: return "THIS";
	    	case 44: return "TRUE";
	    	case 45: return "VOID";
	    	case 46: return "WHILE";
	    	case 47: return "EOF";
    	}
    	return "";
    }
    
    
    
}

